package com.java.zhuiyun.api.fuzzy_query.mapper;

import com.java.zhuiyun.api.fuzzy_query.entity.FuzzQuery;
import com.java.zhuiyun.common.mapper.BaseMapper;
import com.java.zhuiyun.common.response.CommonResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @InterfaceName FuzzyQueryMapper
 * @Description TODO
 * @Author WX
 * @Date 2023/8/24 16:30
 **/
@Mapper
public interface FuzzyQueryMapper extends BaseMapper<FuzzQuery> {
    /*
     * @Author WX
     * @Description 通过值查询
     * @Date 2023/8/24 16:31
     * @Return
     * @param searchValue
     */
    @Select("SELECT * FROM course c, teacher t WHERE c.del_flag = 0  AND c.teacher_id = t.id AND LOWER(c.course_title) LIKE CONCAT('%', LOWER(#{searchValue}), '%')")
    List<FuzzQuery> makeBackendRequestValue(String searchValue);

    /*
     * @Author WX
     * @Description 通过id查询
     * @Date 2023/8/24 16:31
     * @Return
     * @param tiaoId
     */
    @Select("SELECT * FROM course c,teacher t WHERE c.del_flag = 0  AND c.teacher_id = t.id and c.subject_id = #{tiaoId}")
    List<FuzzQuery> makeBackendRequestTiaoId(Integer tiaoId);

    /*
     * @Author WX
     * @Description 查询字典表对应的分类名称
     * @Date 2023/8/24 21:21
     * @Return
     * @param tiaoId
     */
    @Select("SELECT dict_name FROM sys_dict WHERE id = #{tiaoId}")
    String makeQueryDict(Integer tiaoId);
}
